/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.IOException;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import servidor.Servidor;

/**
 *
 * @author Lucas
 * faz o controle da tela inciial....
 */
public class SampleController implements Initializable {

    @FXML
    private Label lbIP;
    @FXML
    private Label lbPorta;
    @FXML
    private Button btLigarServer;

    @FXML
    private void ligarServidor(ActionEvent event) throws IOException {
        Servidor.getInstancia().alteraTela("/view/ServerOline.fxml");
    }

    @Override
    public void initialize(URL url, ResourceBundle rb) {
        try {
            lbIP.setText(InetAddress.getLocalHost().getHostAddress());
            lbPorta.setText("5555");

            //Efeito msg...
            Tooltip t = new Tooltip();
            t.setText("Clique aqui para iniciar o servidor do jogo!");
            btLigarServer.setTooltip(t);
        } catch (UnknownHostException ex) {
            Logger.getLogger(SampleController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
